﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Text.RegularExpressions;
using System.Runtime.Serialization;

namespace Puzzle
{
    public class Gen
    {
        public static T DeepClone<T>(T obj)
        {
            using (var ms = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(ms, obj);
                ms.Position = 0;

                return (T)formatter.Deserialize(ms);
            }
        }
    }

    [Serializable]
    public class CustomExc : System.Exception
    {
        public CustomExc(string errorMessage)
            : base(errorMessage)
        {

        }


        public CustomExc(string errorMessage,
            System.Exception innerExc)
            : base(errorMessage, innerExc)
        {

        }

        protected CustomExc(SerializationInfo si,
            StreamingContext sc)
            : base(si, sc)
        {

        }

        public CustomExc()
            : base()
        {
        }
    }
}
